<%@page import="Model.ConnectDatabase"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Statement"%>
<%@page import="java.sql.Connection"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Admin Shop CH4</title>
        <link href="960.css" rel="stylesheet" type="text/css" media="all" />
        <link href="text.css" rel="stylesheet" type="text/css" media="all" />
        <link href="style.css" rel="stylesheet" type="text/css" media="all" />
        <script type="text/javascript" src="../md5.js"></script>

      
        <style type="text/css">
            .noname{
                font-weight: bold;
                font-size: 15px;
                width: 145px;
                padding-left: 70px;

            }
        </style>
        <script type="text/javascript">
        function convertToMD5(){
            var plaintext = document.getElementById('idpassword').value;
            var md5 = hex_md5(plaintext);
            document.getElementById('hash').value = md5;
        
        }
        
                </script>

       
    </head>

    <body>
        <div class="container_16" id="content">
            <div class="" id="header">
                <div class="grid_4 alpha" id="admin"></div>
                <div class="grid_12 omega" id="menu">
                    <jsp:include page="Navigation.jsp" flush="true">
                        <jsp:param name="accountManage" value="current"/>
                    </jsp:include>
                </div> <!-- End #menu -->
              
            </div> <!-- End #header -->


            <div class="grid_16 alpha omega" id="mainContent">
                <div class="grid_4 alpha" id="leftPanel">
                    <br/>
                </div> <!-- End #leftPanel -->

                <div class="grid_12 omega" id="mainPanel">
                    <h1>Thông tin user</h1>
                    <form action="../QuanLyNguoiDung" method="post" onsubmit="convertToMD5()">
                        <table>
                            <tr>
                                <td class="noname">User name: </td>
                                <td><input type="text" name="username" id="username" size="30" value="">
                                </td>
                                <td><font color="red"  id="username_err"></font></td>
                            </tr>

                            <tr>
                                <td class="noname">Password: </td>
                                <td><input type="password" name="pass" id="idpassword" size="30" >
                                <input type="hidden" name="hash" id="hash">
                                </td>
                                <td><font color="red"  id="pass_err"></font></td>
                            </tr>

                            <tr>
                                <td class="noname">Retype password: </td>
                                <td><input type="password" name="repass" id="repass" size="30" >
                                </td>
                                <td><font color="red"  id="repass_err"></font></td>
                            </tr>

                            <tr>
                                <td class="noname">Họ tên: </td>
                                <td><input type="text" name="name" id="name" size="30"  value="">
                                </td>
                                <td><font color="red"  id="name_err"></font></td>
                            </tr>
                            <tr>
                                <td class="noname">Địa chỉ: </td>
                                <td><textarea name="address" id="address" rows="3" cols="25"></textarea>
                                </td>
                                <td><font color="red"  id="address_err"></font></td>
                            </tr>
                            <tr>
                                <td class="noname">Tỉnh thành: </td>
                                <td><select size="1"  name="province" id="idprovince">
                                       <%
                                                    Connection con3 = ConnectDatabase.getConnection();
                                                    Statement sta3 = con3.createStatement();
                                                    String sql3 = "SELECT * FROM province ";
                                                    ResultSet re3 = sta3.executeQuery(sql3);
                                                    while (re3.next()) {
                                        %>
                                        <option value="<%=re3.getInt(1)%>"><%=re3.getString(2)%></option>

                                        <%}%>
                                       </select>
                                </td>
                            </tr>
                            <tr>
                                <td class="noname">Số điện thoại: </td>
                                <td><input type="text" name="phone" id="phone" size="30" value=""></td>
                                <td><font color="red"  id="phone_err"></font></td>
                            </tr>
                            <tr>
                                <td class="noname">Email: </td>
                                <td><input type="text" name="email" id="email" size="30" value="">
                                </td>
                                <td><font color="red"  id="email_err"></font></td>
                            </tr>
                            <tr>
                                <td class="noname">Quyền hạn: </td>
                                <td>
                                    <select name="roleid">
                                        <option value="1"  >Admin</option>
                                        <option value="0"  >User thường</option>
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td></td>
                                <td>
                                    <input type="submit" value="Thêm" >
                                    <input type="hidden" name = "action" value ="adduser">
                                    <a href="AccountManage.jsp"><input type="button" value="Quay lại"></a>
                                </td>
                            </tr>
                        </table>
                    </form>
                   
                </div> <!-- End #mainPanel -->
            </div> <!-- End #mainContent -->
            <div id="footer" align="center"><font color="white">© 2013 Shop CH4</font></div>
        </div>
    </body>
</html>